home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Design
/
WB Collection.iso
/
workbench werkzeuge
/
icon tools
/
forceicon
/
source
/
checktooltypes.h
next >
Wrap
C/C++ Source or Header
|
1996-04-07
|
2KB
|
84 lines
/**********************************************************************/
/* Check for tooltypes or commandline args, */
/* returning TRUE for FlushMemory */
/**********************************************************************/
#ifdef PREFSRUN
static char *Template = "FLUSH=FLUSHMEMORY/S";
#else
static char *Template = "SNAP=SNAPNOTIFY/N";
#endif
static void CheckToolTypes(struct WBStartup *WBenchMsg)
{
ObtainSemaphore(&FIconSema->FIconSema);
// Launched from WB ???
if(WBenchMsg)
{
struct DiskObject *MyDObj;
struct WBArg *MyWBArg;
BPTR OldDir;
MyWBArg = WBenchMsg->sm_ArgList;
OldDir = CurrentDir(MyWBArg->wa_Lock);
if((MyDObj = GetDiskObjectNew(MyWBArg->wa_Name)))
{
#ifdef PREFSRUN
FlushMemory = (FindToolType(MyDObj->do_ToolTypes, "FLUSHMEMORY") != NULL);
#else
char *Tool;
if((Tool = FindToolType(MyDObj->do_ToolTypes, "SNAPNOTIFY")))
{
SnapNotify = atol(Tool);
if(SnapNotify < 0 || SnapNotify > 2)
SnapNotify = 2;
}
#endif
FreeDiskObject(MyDObj);
}
CurrentDir(OldDir);
}
// Check command line
else
{
APTR *Args;
struct RDArgs *MyRDArgs;
if((Args = AllocVec(2 * sizeof(ULONG), MEMF_CLEAR)))
{
if((MyRDArgs = ReadArgs(Template, (LONG *)Args, NULL)))
{
#ifdef PREFSRUN
FlushMemory = (Args[0] != NULL);
#else
if(Args[0])
{
SnapNotify = *((LONG *)Args[0]);
if(SnapNotify < 0 || SnapNotify > 2)
SnapNotify = 2;
}
#endif
FreeArgs(MyRDArgs);
}
else
DisplayError(IoErr(), NULL);
FreeVec(Args);
}
else
DisplayError(ERR_NOMEM, NULL);
}
ReleaseSemaphore(&FIconSema->FIconSema);
}